package com.ruoyi.purchase.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.purchase.domain.Firm;
import com.ruoyi.purchase.service.FirmService;
import com.ruoyi.purchase.mapper.FirmMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 *
 */
@Service
public class FirmServiceImpl extends ServiceImpl<FirmMapper, Firm>
    implements FirmService{
    @Autowired
    private FirmMapper firmMapper;

    @Override
    public List<Firm> queryList(Firm firm) {
        QueryWrapper<Firm> queryWrapper = Wrappers.query();
        if (StringUtils.isNotEmpty(firm.getFirmName()))
        {
            queryWrapper.eq("firm_name", firm.getFirmName());
        }
        if (StringUtils.isNotEmpty(firm.getFirmChargeUser()))
        {
            queryWrapper.eq("firm_charge_user", firm.getFirmChargeUser());
        }
        if (StringUtils.isNotNull(firm.getSysCityId()))
        {
            queryWrapper.eq("sys_city_id", firm.getSysCityId());
        }
        if (StringUtils.isNotEmpty(firm.getStatus()))
        {
            queryWrapper.eq("status", firm.getStatus());
        }
        return firmMapper.selectList(queryWrapper);
    }
}




